/*
 * GPB configuration, data and up register addesses
 */
#define GPBCON   (*(volatile unsigned long *)0x56000010)
#define GPBDAT   (*(volatile unsigned long *)0x56000014)
#define GPBUP    (*(volatile unsigned long *)0x56000018)

#define LED0     5    /* LED0 use GPB5 */
#define LED1     6    /* LED1 use GPB6 */
#define LED2     7    /* LED2 use GPB7 */
#define LED3     8    /* LED3 use GPB8 */

#define GPB5_OUT (1<<(LED0*2))
#define GPB6_OUT (1<<(LED1*2))
#define GPB7_OUT (1<<(LED2*2))
#define GPB8_OUT (1<<(LED3*2))

#define DELAY_TIME 1000

static inline
void delay (unsigned int loops)
{
    int i, j;

    for (i = 0; i < loops; i++) {
        for (j = 0; j < 0x7fffffff; j++) {
            ;
        }
    }
}


int main()
{
    GPBCON = GPB5_OUT | GPB6_OUT | GPB7_OUT | GPB8_OUT;
    GPBUP  = (1 << LED0) | (1 << LED1) | (1 << LED2) | (1 << LED3);

    /* turn on led0 */
    GPBDAT = ~(1 << LED0);
    delay(DELAY_TIME);

    /* turn on led1 */
    GPBDAT = ~(1 << LED1);
    delay(DELAY_TIME);

    /* turn on led2 */
    GPBDAT = ~(1 << LED2);
    delay(DELAY_TIME);

    /* turn on led3 */
    GPBDAT = ~(1 << LED3);
    delay(DELAY_TIME);
    
    return 0;
}
